package org.slf4jx.core;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.function.Function;

/**
 * 修改LogFactory 的getLogger 插入这段代码
 * @author jjliu
 * @date 2023/1/14
 */
public class Slf4jxGetLoggerFunction implements Function<String,Logger> {

    @Override
    public Logger apply(String s) {
        org.slf4j.ILoggerFactory iLoggerFactory = LoggerFactory.getILoggerFactory();
        Logger logger = iLoggerFactory.getLogger(s);
        Logger loggerWrap = (Logger)new Slf4jxLoggerCglibProxy().getProxy(logger);
        return loggerWrap;
    }
}
